package org.rency.crawler.common.exception;

import org.rency.crawler.common.enums.ReturnCode;

public class CrawlerIllegalException extends IllegalArgumentException {

  /**
   *
   */
  private static final long serialVersionUID = 4508892195634590017L;

  private ReturnCode returnCode;
  private String detailMessage;

  public CrawlerIllegalException() {
    super();
    this.returnCode = ReturnCode.ILLEGAL_VALID;
  }

  public CrawlerIllegalException(String detailMessage) {
    this(ReturnCode.ILLEGAL_VALID, detailMessage);
  }

  public CrawlerIllegalException(ReturnCode errorCode, String detailMessage) {
    super(String.format("%s:%s[%s]", errorCode.getCode(), errorCode.getMsg(), detailMessage));
    this.returnCode = returnCode;
    this.detailMessage = detailMessage;
  }

  public ReturnCode getReturnCode() {
    return returnCode;
  }

  public void setReturnCode(ReturnCode returnCode) {
    this.returnCode = returnCode;
  }

  public String getDetailMessage() {
    return detailMessage;
  }

  public void setDetailMessage(String detailMessage) {
    this.detailMessage = detailMessage;
  }
}
